//集成
class Animal{
    public constructor(theName:string){
        this.name=theName;
    }
   public name:string;
   public move(stype:number):void{
        console.log(`Animal moved ${Number}`)
    }
}
class Dog extends Animal{
    constructor(name:string){
        super(name);
    }
    bark(){
        console.log("Woof woof!")
    }
    move(stype=5){
        console.log("dog !dog!")
        super.move(stype)
    }
}

const dog=new Dog("dog");
dog.bark();
dog.move(5);


//只读属性(使用 readonly关键字将属性设置为只读的。 只读属性必须在声明时或构造函数里被初始化。)
class Octopus{
    public readonly Name:string;
    public readonly numberOfLegs:number=8;
    constructor(theName:string){
        this.Name=theName;
    }
}
let dad=new Octopus("Man With the 8 strong legs");

//存取器
let passcode = "secret passcode";
class Employee{
    private _fullName;string;
    get fullName():string{
        return this._fullName
    }
    set fullName(newName:string){
        if (passcode && passcode == "secret passcode") {
            this._fullName = newName;
        }
        else {
            console.log("Error: Unauthorized update of employee!");
        }
    }
}

let employee=new Employee()
employee.fullName="张三"


//抽象类
abstract class Department {

    constructor(public name: string) {
    }

    printName(): void {
        console.log('Department name: ' + this.name);
    }

    abstract printMeeting(): void; // 必须在派生类中实现
}

class AccountingDepartment extends Department{
    constructor(){
        super('Accounting and Auditing'); // 在派生类的构造函数中必须调用 super()
    }
    printMeeting():void{
        console.log(" ");
    }
    generateReports():void{
        console.log("  ")
    }
}
let department:Department=new AccountingDepartment();
department.printMeeting() //调用的子类中的方法
department.name
department.printName()


